package org.qpcr.community.project.model.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
import org.hswebframework.web.api.crud.entity.GenericEntity;
import org.hswebframework.web.api.crud.entity.RecordCreationEntity;
import org.hswebframework.web.api.crud.entity.RecordModifierEntity;
import org.hswebframework.web.crud.annotation.EnableEntityEvent;
import org.hswebframework.web.crud.generator.Generators;
import org.hswebframework.web.validator.CreateGroup;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

@Getter
@Setter
@Table(name = "biz_data_analysis_dashboard_charts_filter_condition")
@Comment("实验数据分析图表筛选条件")
@EnableEntityEvent
public class DataAnalysisDashboardChartsFilterConditionEntity extends GenericEntity<String> implements RecordCreationEntity, RecordModifierEntity {
    @Override
    @Id
    @Column(length = 64, updatable = false)
    @Schema(description = "ID")
    @GeneratedValue(generator = Generators.SNOW_FLAKE)
    @NotBlank(message = "ID不能为空", groups = CreateGroup.class)
    public String getId() {
        return super.getId();
    }

    @Column(name = "creator_id", updatable = false)
    @Schema(
        description = "创建者ID(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String creatorId;

    @Column(name = "creator_name", updatable = false)
    @Schema(
        description = "创建者名称(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String creatorName;

    @Column(name = "create_time", updatable = false)
    @DefaultValue(generator = Generators.CURRENT_TIME)
    @Schema(
        description = "创建时间(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private Long createTime;

    @Column
    @DefaultValue(generator = Generators.CURRENT_TIME)
    @Schema(
        description = "修改时间"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private Long modifyTime;

    @Column(length = 64)
    @Schema(
        description = "修改人ID"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String modifierId;

    @Column(length = 64)
    @Schema(
        description = "修改人名称"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String modifierName;


    @Column(name = "group_id", length = 64)
    @Schema(description = "分组ID")
    private String groupId;

    @Column(name = "chart_id", length = 64)
    @Schema(description = "图表ID")
    private String chartId;

    @Column(name = "field", length = 64)
    @Schema(description = "字段")
    private String field;

    @Column(name = "field_name", length = 64)
    @Schema(description = "字段名称")
    private String fieldName;

    @Column(name = "operator", length = 64)
    @Schema(description = "操作符")
    private String operator;

    @Column(name = "value1", length = 64)
    @Schema(description = "值1")
    private String value1;

    @Column(name = "value2", length = 64)
    @Schema(description = "值2")
    private String value2;

}
